<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script>
// import Index from "./components/Index-main";

export default {
  name: 'App',
  components: {},
  data () {
    return {
      user: JSON.parse (sessionStorage.getItem ('CurUser'))
    }
  },

  //监听路由变化,修复动态路由丢失问题
  watch: {
    '$store.state.menu': {
      handler (val, old) {
        if (!old && this.user && this.user.no) {
          this.$store.commit ("setMenu", val)
        }
      },
      immediate: true
    }
  }


}
</script>

<style>
#app {

}
</style>
